home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Collection of Tools & Utilities
/
Collection of Tools and Utilities.iso
/
olrdrs
/
qwkndt1a.zip
/
SCRIPT.DOC
< prev
next >
Wrap
Text File
|
1992-11-06
|
7KB
|
198 lines
The QWK'n'Dirty Script Language
Copyright 1992 by
Anthony W. Hursh
Many terminal programs have a script language that can
be used to automate the logon process. The QWK'n'Dirty script
language goes beyond that. It lets you automatically upload and
download .REP and .QWK packets without any human intervention,
something that would be difficult (if not impossible) with most
other script languages.
A QWK'n'Dirty script is a text file with a .SCR extension.
To use a script, go into the QWK'n'Dirty dialing menu and choose [E]
to edit the system. When you're asked for the name of the script file,
enter the file name of your script. Do not enter the .SCR extension. This
is automatically added by QWK'n'Dirty. The next time you call that system
QWK'n'Dirty will execute the script.
Several example scripts are included with the QWK'n'Dirty
distribution. After reading this document, you should study them
to gain a further insight into how the script language works.
SCRIPT COMMANDS
A QWK'n'Dirty script command consists of a keyword optionally followed by
character strings or numbers. Keywords can be typed in either lower or
upper case, whichever you prefer. In the following command list,
<string> denotes an arbitrary sequence of characters. [number]
denotes a decimal number. Strings must be enclosed in double quotes,
but do not quote numbers.
SEND <string>
This is used to send a character string to the remote system.
The command:
SEND "FOOBAR"
will cause the word _FOOBAR_ to be sent out the modem.
The command:
SEND "luser\r"
will send the word _luser_, followed by a carriage return. The
\r is an escape sequence for carriage return. See "Escape
Sequences", below, for other available escape sequences.
EXPECT <expected> <failure> [retries]
The EXPECT command waits for the <expected> string until
it's either received or the timeout period expires (see
TIMEOUT, below). <failure> and [retries] are optional.
If the <failure> string is supplied, it is sent in the event
of a timeout. [retries] is the number of times to check for the
<expected> string. If [retries] is used, <failure> must also be
present.
The command:
EXPECT "login:"
will wait for the string _login:_ to be sent from the remote
system. If it is received before the timeout period has
expired, the script continues executing. If the timeout
period *does* expire before getting _login:_, script execution
will be aborted. In addition, if QWK'n'Dirty is running in Golem
Mode (unattended), it will attempt to hang up the phone if an
EXPECT command times out.
The command:
EXPECT "username:" "\r" 5
will wait for the string _username:_ to be sent from the
remote system. If it is not received within the timeout
period, QWK'n'Dirty will send a carriage return (the "\r") and
try again. QWK'n'Dirty will continue waiting for _username:_
and sending return for a maximum of [retries] times, 5 times
in this example. If it doesn't see _username:_ within 5 tries
the script is aborted. This feature is handy for systems that
require you to hit return a number of times to "wake up the
modem" before logging on.
Be warned: the <expected> string *is* case sensitive.
EXPECT "username:"
is *not* the same as
EXPECT "Username:"
Make sure to enter the strings in the same case that the BBS
uses.
UPLOAD
This command uploads a .REP packet to the BBS using the
previously selected protocol.
DOWNLOAD
This command downloads a .QWK packet from the BBS using
the previously selected protocol.
TIMEOUT [seconds]
This command is used to adjust the timeout period for
the EXPECT command. By default, the timeout period
is set for 30 seconds. The command:
TIMEOUT 10
will set the timeout period to 10 seconds instead.
The new setting remains in effect until another
TIMEOUT command is issued.
SLEEP [seconds]
This command causes the script to "go to sleep" for the
specified number of seconds. It's useful for wasting
time while (e.g.) a program loads on the BBS or the
QWK packet is being generated. The command:
SLEEP 5
will cause the script to go on hold for 5 seconds.
REPBEGIN
This command is used to introduce the .REP section. Any
script commands between REPBEGIN and REPEND will be
executed only if there is a .REP packet waiting for the
system.
REPEND
This command is used to end the .REP section.
HANGUP
Attempt to hang up the phone.
PAUSESTR <pause> <unpause>
Sets the "pause string" for the script. Many BBS programs
send a specific string at the end of a screen of text.
It's usually something like "--More--", "Press enter to
continue", "[PAUSE]", or the like. It's hard to predict
exactly when these pauses will occur because sysops
have a tendency to change these text screens often.
With PAUSESTR you can avoid having this mess up your
scripts. If you set PAUSESTR, any time QWK'n'Dirty detects the
<pause> string while it's in an EXPECT command it sends
the <unpause> string. The command:
PAUSESTR "Press ENTER to continue" "\r"
will cause QWK'n'Dirty to send a return every time it sees
_Press ENTER to continue_. The command:
PAUSESTR "--More--" "n\r"
will cause QWK'n'Dirty to send n followed by return every time
it sees a _--More--_ prompt. PAUSESTR can be use with any
sort of repetitive screen pause prompt.
ESCAPE SEQUENCES
Sometimes you'll need to send or detect a character that is difficult
or impossible to type directly. For these situations, the script
language allows you to use escape sequences. An escape sequence
consists of a backslash character followed by another character.
The following escape sequences are recognized by QWK'n'Dirty:
\r carriage return (ASCII 13)
\n line feed (ASCII 10)
\t tab (ASCII 9)
\b backspace (ASCII 8)
\c Control-C (ASCII 3)
\e Escape (ASCII 27)
\x Control-X (ASCII 24)
\" Double quote (ASCII 34)
\\ Backslash (ASCII 92)